{% extends "oj_base.html" %}
{% block title %}
    小组列表
{% endblock %}
{% block body %}
    {% load problem %}
    <div class="container main">
        <div class="row">
            <div class="col-md-9 col-lg-9">
                <div class="row">
                    <div class="right">
                        <form class="form-inline" method="get">
                            <div class="form-group-sm">
                                <input name="keyword" class="form-control" placeholder="请输入关键词">
                                <input type="submit" value="搜索" class="btn btn-primary">
                            </div>
                        </form>
                    </div>
                </div>
                <div>
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>名称</th>
                            <th>加入方式</th>
                            <th>创建者</th>
                            <th>创建时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for item in groups %}
                            <tr>
                                <th scope="row"><a href="/group/{{ item.id }}/" target="_blank">{{ item.id }}</a></th>
                                <td><a href="/group/{{ item.id }}/" target="_blank">{{ item.name }}</a></td>
                                <td>
                                    {% ifequal item.join_group_setting 1 %}
                                        需要申请
                                    {% endifequal %}
                                    {% ifequal item.join_group_setting 0 %}
                                        无需申请
                                    {% endifequal %}
                                    {% ifequal item.join_group_setting 2 %}
                                        不允许加入
                                    {% endifequal %}
                                </td>
                                <td>{{ item.created_by }}</td>
                                <td>{{ item.create_time }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    <nav>
                        <ul class="pager">
                            {% if previous_page %}
                                <li class="previous"><a
                                        href="/groups/{{ previous_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}">
                                    <span aria-hidden="true">&larr;</span> 上一页</a>
                                </li>
                            {% endif %}
                            {% if next_page %}
                                <li class="next">
                                    <a href="/groups/{{ next_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}">
                                        下一页 <span aria-hidden="true">&rarr;</span>
                                    </a>
                                </li>
                            {% endif %}
                        </ul>
                    </nav>
                </div>
            </div>

            <div class="col-md-3 col-lg-3">
                {% include "oj/announcement/_announcement_panel.html" %}
            </div>
        </div>
    </div>
{% endblock %}
